/***********************************
* Name: InterMethodCall.java
* Date: Oct 7, 2010
* @author martin
* Description:
***********************************/

package interCodeGen;


public class InterMethodCall implements Cod3Dir{
    private String temp_retorno = "";
    private String nombre_funcion = "";
    private String cant_params = "";
    private boolean void_type;


    //si es void
    //call funcion, parametros
    //si no es void
    //temp1 = call funcion, parametros

    

    /*****************************************
     * InterAsignacion
     * constructor
     *****************************************/
    public InterMethodCall(String temp_retorno, String nombre_funcion, String cant_params){
        this.temp_retorno = temp_retorno;
        this.nombre_funcion = nombre_funcion;
        this.cant_params = cant_params;

        void_type = false;
    }

    /*****************************************
     * InterAsignacion
     * constructor
     *****************************************/
    public InterMethodCall(String nombre_funcion, String cant_params){

        this.temp_retorno = "";
        this.nombre_funcion = nombre_funcion;
        this.cant_params = cant_params;

        void_type = true;
    }

    /*****************************************
     * @return the label_retorno
     *****************************************/
    public String getTemp_retorno() {
        return temp_retorno;
    }

    /*****************************************
     * @return the nombre_funcion
     *****************************************/
    public String getNombre_funcion() {
        return nombre_funcion;
    }

    /*****************************************
     * @return the cant_params
     *****************************************/
    public String getCant_params() {
        return cant_params;
    }

    /*****************************************
     * @return the void_type
     *****************************************/
    public boolean isVoid_type() {
        return void_type;
    }
    
    /*****************************************
     * getCodeString
     * @return the complete code of the Cod3Dir
     *****************************************/
    public String getCodeString() {
        if(isVoid_type()){
            return "\t"+"call "+this.getNombre_funcion()+", "+this.getCant_params();
        }
        return "\t"+this.getTemp_retorno()+" = call "+this.getNombre_funcion()+", "+this.getCant_params();
    }

}